#ifndef PIPE_H__
#define PIPE_H__


#include "ringbuffer.h"
#include "ptdebug.h"
#include "device.h"
#include "pt_ipc.h"

/**
 * Pipe Device
 */

#define PIPE_BUFSZ    512

struct pt_pipe_device
{
    struct pt_device parent;

    /* ring buffer in pipe device */
    struct pt_ringbuffer *fifo;
    uint16_t bufsz;

//    uint8_t readers;
//    uint8_t writers;

//    rt_wqueue_t reader_queue;
//    rt_wqueue_t writer_queue;

    struct pt_mutex lock;
};
typedef struct pt_pipe_device pt_pipe_t;

pt_pipe_t * pt_pipe_create ( uint8_t  device_id, int bufsz );
int pt_pipe_delete ( uint8_t  device_id );
#endif /* PIPE_H__ */
